package com.peaksport.pkms.base.entity;

import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Convert;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.peaksport.framework.base.entity.CoreBaseEntity;
import com.peaksport.framework.base.venum.BaseIntConverter;
import com.peaksport.framework.uuid.PKEntityType;
import com.peaksport.pkms.base.venum.KFMsgTypeEnum;
import com.peaksport.pkms.oauth.entity.ClientEntity;
import com.peaksport.pkms.permit.entity.UserEntity;

import lombok.Getter;
import lombok.Setter;


@SuppressWarnings("serial")
@Entity
@Table(name = "CT_KF_ProduceMsg")
@Getter
@Setter
public class KFProduceMsgEntity extends CoreBaseEntity {

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FSenderID")
	private UserEntity sender;
	@Column(name="FSendTime")
	private Date sendTime;
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FClientId")
	private ClientEntity client;
	@Convert(converter = BaseIntConverter.class)
	@Column(name="FType")
	private KFMsgTypeEnum type;
	@Column(name="FTopic")
	private String topic;
	@Column(name="FMsgId")
	private String msgId;
	@Lob 
	@Basic(fetch = FetchType.LAZY) 
	@Column(name = "FMsgBody")
	private String msgBody;
	@Column(name="FIsSuccess")
	private boolean isSuccess;
	
	@Override
	public PKEntityType getEntityType() {
		return PKEntityType.create("5CF71B54");
	}
}
